
# -*- coding: utf-8-*-
import time

# from .respeaker_v2_pixel_ring import respeaker_v2_pixel_ring
# from .respeaker_v2_pixel_ring import respeaker_v2_pixel_ring
# from  import respeaker_v2_pixel_ring
# from .respeaker_v2_pixel_ring import PixelRing
import mraa
# import respeaker_v2_pixel_ring
# from respeaker_v2_pixel_ring import PixelRing
# import respeaker_v2_pixel_ring
import respeaker_v2_pixel_ring
# import .respeaker_v2_pixel_ring.PixelRing
# from client import respeaker_v2_pixel_ring

import os

#将LED基础控制模块赋值到pixel_ring，方便后续调用
pixel_ring = respeaker_v2_pixel_ring.find()

#这里还没有深入了解，暂时放过
en = mraa.Gpio(12)
if os.geteuid() != 0 :
    time.sleep(1)

en.dir(mraa.DIR_OUT)
en.write(0)

#设置LED灯的亮度1-100，这里设置20
pixel_ring.set_brightness(20)

#业务的实现
if __name__ == '__main__':

    while True:

        try:
            pixel_ring.wakeup()
            time.sleep(3)
            pixel_ring.think()
            time.sleep(3)
            pixel_ring.speak()
            time.sleep(6)
            pixel_ring.off()
            time.sleep(3)
        except KeyboardInterrupt:
            break

    pixel_ring.off()
    time.sleep(1)

en.write(1)